{extend name="../../admin/view/main"}

{block name="content"}

<div class="layui-card-body">
    <div class="layui-form-item">
        <span class="color-desc margin-left-5">当前债权匹配的投资</span>
        <table class="layui-table" id="property-table">
            <thead>
            <tr>
                <th class="nowrap text-center">客户编号</th>
                <th class="nowrap text-center">合同编号</th>
                <th class="nowrap text-center">投资人</th>
                <th class="nowrap text-left">投资规模</th>
                <th class="nowrap text-left">投资结束日期</th>
                <th class="nowrap text-left">匹配价值</th>
            </tr>
            </thead>
            <tbody>
            {foreach $order_property as $k => $v}
            <tr>
                <td class="padding-0 text-center">{$v.customer_no|default='--'}</td>
                <td class="padding-0 text-center">{$v.contract_no|default='--'}</td>
                <td class="padding-0 text-center">{$v.user_name|default='--'}</td>
                <td class="padding-0 text-center">{$v.order_money|default='--'}</td>
                <td class="padding-0 text-center">{$v.end_at|default='--'}</td>
                <td class="padding-0 text-center">{$v.property_match_cost|default='--'}</td>
                <td>
                    <a class="layui-btn layui-btn-sm  del"  data-id="{$v.id}">解抵</a>
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
    </div>
</div>

{/block}

{block name='script'}

<script>
    window.form.render();

    $('body').on('click', '.del', function() {
        let tr = $(this)

        $.post("{:url()}?action=del", {id:$(this).attr('data-id')}, function (data){
            if (data.code == 1){
                tr.closest('tr').remove();
                layer.msg(data.info)
                $('.layui-table').reload()
            }else {
                layer.msg(data.info)
            }
        })
    });
</script>
{/block}